Socket
Socket
Sign inDemoInstall

getos

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getos

Get the OS/Distribution name of the environment you are working on


Version published
Maintainers
3
Created

What is getos?

The getos npm package is used to detect the operating system of the environment in which a Node.js application is running. It provides a simple API to retrieve detailed information about the OS, including the distribution name and version for Linux systems.

What are getos's main functionalities?

Detect Operating System

This feature allows you to detect the operating system of the environment. The callback function returns an object containing details about the OS, such as the distribution name and version for Linux systems.

const getos = require('getos');

getos((e, os) => {
  if (e) return console.log(e);
  console.log(os);
});

Detect Linux Distribution

This feature is specifically useful for detecting the Linux distribution and its version. The callback function checks if the OS is Linux and then logs the distribution name and version.

const getos = require('getos');

getos((e, os) => {
  if (e) return console.log(e);
  if (os.os === 'linux') {
    console.log(`You are running ${os.dist} version ${os.release}`);
  }
});

Other packages similar to getos

Keywords

FAQs

Package last updated on 19 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc